#include <iostream>

using std::cout;
using std::endl;

class Example
{
public:
    Example()
    {
        cout << "Example()" << endl;
    }

    Example(const Example &rhs)
    {
        cout << "Example(const Example &)" << endl;
    }

    ~Example()
    {
        cout << "~Example()" << endl;
    }
};

void test()
{
    Example ex;//ex是栈对象
    {
        Example &ex2 = ex;
        cout << "1111" << endl;
    }
    cout << "222" << endl;

    /* ex; */
    /* ex2;//error */
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

